package com.lujianfei.imagesearch.ui;

import com.lujianfei.imagesearch.Constants;
import com.lujianfei.imagesearch.base.BaseChildWindow;
import com.lujianfei.imagesearch.ui.subui.CanvasWindow;
import com.lujianfei.imagesearch.ui.subui.MnistImageWindow;
import com.lujianfei.imagesearch.ui.subui.MnistLabelWindow;
import com.lujianfei.imagesearch.utils.MnistReader.MnistInfo;

public class ChildWindowFactory {

	public static BaseChildWindow getChildWindow(String absolutePath,int type,MnistInfo info) {
		BaseChildWindow childFrame = null;
		switch (type) {
		case Constants.SUBFrameType.IMAGE:
		{
			childFrame = new CanvasWindow();
			childFrame.setBounds(0,0,childFrame.getWidth(),childFrame.getHeight());
			childFrame.setVisible(true);
			((CanvasWindow)childFrame).setFileName(absolutePath);
			info.success = true;
		}
			break;
		case Constants.SUBFrameType.MNIST_DATA:
		{
			childFrame = new MnistImageWindow();
			childFrame.setBounds(0,0,childFrame.getWidth(),childFrame.getHeight());
			childFrame.setVisible(true);
			((MnistImageWindow)childFrame).setFileName(absolutePath,info);
		}
		break;
		case Constants.SUBFrameType.MNIST_LABEL:
		{
			childFrame = new MnistLabelWindow();
			childFrame.setBounds(0,0,childFrame.getWidth(),childFrame.getHeight());
			childFrame.setVisible(true);
			((MnistLabelWindow)childFrame).setFileName(absolutePath,info);
		}
		break;
		default:
			break;
		}
		return childFrame;
	}
}
